package thead;

public class Demo10 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
            for(int i = 0; i < 3;i++) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("t 工作中");
            }
            System.out.println("t 工作结束");
        });
        t.start();
        System.out.println("主线程开始等待");
//        t.join();
        t.join(2000);
        System.out.println("主线程等待结束");
    }
}
